var reviveCount = 5;
var mapIds = [921172300];
var 准备地图 = 450005000;
var eventName = "日常_阿尔卡那_灵魂拯救者";
var 石精灵HP = 10000000000;
var 怪物等级 = 225;
var 残骸刷新时间 = 30;
var 石精灵刷新时间 = 10;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance(eventName);
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b]);
        d.resetFully();
        d.killAllMonsters(true);
        c.startEventTimer(1000 * 60 * 3);
        c.schedule("summonMob", 1000 * 6);
        c.schedule("sumMob", 1000 * 12)
    }
    return c
}

function sumMob(a) {
    var b;
    b = a.getMapInstance(921172300);
    var c = 8644201;
    if (b.getNumMonsters() < 40) {
        mob = em.getMonster(c);
        mob.setOverrideStats();
        mob.getChangedStats().hp = 10000000000;
        mob.heal();
        b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-2085, -1211));
        mob = em.getMonster(c);
        mob.setOverrideStats();
        mob.getChangedStats().hp = 10000000000;
        mob.heal();
        b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-195, -1391));
        mob = em.getMonster(c);
        mob.setOverrideStats();
        mob.getChangedStats().hp = 10000000000;
        mob.heal();
        b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1808, -1211));
        mob = em.getMonster(c);
        mob.setOverrideStats();
        mob.getChangedStats().hp = 10000000000;
        mob.heal();
        b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-2144, -1942));
        mob = em.getMonster(c);
        mob.setOverrideStats();
        mob.getChangedStats().hp = 10000000000;
        mob.heal();
        b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1889, -1939))
    }
    if (em.getProperty("state").equals("1")) {
        a.schedule("sumMob", 1000 * 残骸刷新时间)
    }
}

function summonMob(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644101);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-2180, -1751));
    mob = em.getMonster(8644102);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1614, -971));
    mob = em.getMonster(8644103);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-869, -731));
    mob = em.getMonster(8644104);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1360, -1991));
    mob = em.getMonster(8644105);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(533, -731));
    mob = em.getMonster(8644106);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1370, -971));
    mob = em.getMonster(8644107);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1902, -1751));
    mob = em.getMonster(8644108);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1097, -1991))
}

function summonMob1(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644101);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-2180, -1751))
}

function summonMob2(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644102);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1614, -971))
}

function summonMob3(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(石精灵HP);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-869, -731))
}

function summonMob4(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644104);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-1360, -1991))
}

function summonMob5(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644105);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(533, -731))
}

function summonMob6(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644106);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1370, -971))
}

function summonMob7(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644107);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1902, -1751))
}

function summonMob8(a) {
    var b;
    b = a.getMapInstance(921172300);
    mob = em.getMonster(8644108);
    mob.setOverrideStats();
    mob.getChangedStats().hp = 石精灵HP;
    mob.getChangedStats().level = 怪物等级;
    mob.heal();
    b.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1097, -1991))
}

function onPlayerRegistered(b, a) {
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0))
}

function onPlayerRevived(b, a) {
    return false
}

function onMonsterKilled(a, b) {
    var c;
    c = a.getMapInstance(921172300);
    if (b == 8644101) {
        a.schedule("summonMob1", 1000 * 石精灵刷新时间);
        p.getAPI().spawnReactorOnGroundBelow(3600001, -2163, -1751);
        p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
        if (!p.getAPI().haveMonster(8644301)) {
            mob = em.getMonster(8644301);
            mob.setOverrideStats();
            mob.getChangedStats().hp = 10000000000;
            mob.getChangedStats().level = 怪物等级;
            mob.heal();
            c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-3163, -1751))
        }
    } else {
        if (b == 8644102) {
            a.schedule("summonMob2", 1000 * 石精灵刷新时间);
            p.getAPI().spawnReactorOnGroundBelow(3600001, -1614, -971);
            p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
            if (!p.getAPI().haveMonster(8644301)) {
                mob = em.getMonster(8644301);
                mob.setOverrideStats();
                mob.getChangedStats().hp = 10000000000;
                mob.getChangedStats().level = 怪物等级;
                mob.heal();
                c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-3163, -971))
            }
        } else {
            if (b == 8644103) {
                a.schedule("summonMob3", 1000 * 石精灵刷新时间);
                p.getAPI().spawnReactorOnGroundBelow(3600001, -869, -731);
                p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
                if (!p.getAPI().haveMonster(8644301)) {
                    mob = em.getMonster(8644301);
                    mob.setOverrideStats();
                    mob.getChangedStats().hp = 10000000000;
                    mob.getChangedStats().level = 怪物等级;
                    mob.heal();
                    c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-2065, -731))
                }
            } else {
                if (b == 8644104) {
                    a.schedule("summonMob4", 1000 * 石精灵刷新时间);
                    p.getAPI().spawnReactorOnGroundBelow(3600001, -1360, -1991);
                    p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
                    if (!p.getAPI().haveMonster(8644301)) {
                        mob = em.getMonster(8644301);
                        mob.setOverrideStats();
                        mob.getChangedStats().hp = 10000000000;
                        mob.getChangedStats().level = 怪物等级;
                        mob.heal();
                        c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(-130, -1991))
                    }
                } else {
                    if (b == 8644105) {
                        a.schedule("summonMob5", 1000 * 石精灵刷新时间);
                        p.getAPI().spawnReactorOnGroundBelow(3600001, 533, -731);
                        p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
                        if (!p.getAPI().haveMonster(8644301)) {
                            mob = em.getMonster(8644301);
                            mob.setOverrideStats();
                            mob.getChangedStats().hp = 10000000000;
                            mob.getChangedStats().level = 怪物等级;
                            mob.heal();
                            c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(1900, -731))
                        }
                    } else {
                        if (b == 8644106) {
                            a.schedule("summonMob6", 1000 * 石精灵刷新时间);
                            p.getAPI().spawnReactorOnGroundBelow(3600001, 1370, -971);
                            p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
                            if (!p.getAPI().haveMonster(8644301)) {
                                mob = em.getMonster(8644301);
                                mob.setOverrideStats();
                                mob.getChangedStats().hp = 10000000000;
                                mob.getChangedStats().level = 怪物等级;
                                mob.heal();
                                c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(10, -971))
                            }
                        } else {
                            if (b == 8644107) {
                                a.schedule("summonMob7", 1000 * 石精灵刷新时间);
                                p.getAPI().spawnReactorOnGroundBelow(3600001, 1902, -1751);
                                p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
                                if (!p.getAPI().haveMonster(8644301)) {
                                    mob = em.getMonster(8644301);
                                    mob.setOverrideStats();
                                    mob.getChangedStats().hp = 10000000000;
                                    mob.getChangedStats().level = 怪物等级;
                                    mob.heal();
                                    c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(250, -1751))
                                }
                            } else {
                                if (b == 8644108) {
                                    a.schedule("summonMob8", 1000 * 石精灵刷新时间);
                                    p.getAPI().spawnReactorOnGroundBelow(3600001, 1097, -1991);
                                    p.getAPI().getMap().startSimpleMapEffect("注意！剧毒精灵正在接近……！", 5120175);
                                    if (!p.getAPI().haveMonster(8644301)) {
                                        mob = em.getMonster(8644301);
                                        mob.setOverrideStats();
                                        mob.getChangedStats().hp = 10000000000;
                                        mob.getChangedStats().level = 怪物等级;
                                        mob.heal();
                                        c.spawnMonsterOnGroundBelow(mob, new java.awt.Point(2600, -1991))
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    switch (a) {
        case 921172300:
            initProp("stage" + 1 + "_kill", 0);
            break
    }
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function Chuansong(b, a) {
    warp(b, 450005015, 0)
}

function openNpc(c, b, d) {
    for (var a = 0; a < c.getPlayerCount(); a++) {
        c.getPlayers().get(a).getAPI().openNpc(b, d)
    }
}

function warp(d, c, a) {
    for (var b = 0; b < d.getPlayerCount(); b++) {
        d.getPlayers().get(b).getAPI().warp(c, a)
    }
}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
}

function onMonsterDamaged(b, a, d, e, c) {}

function onItemPickedUp() {};